<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-03-26 01:16:12
 * @LastEditors: Sam
 * @LastEditTime: 2023-01-10 11:12:29
 */

use think\facade\Route;

Route::miss(function() {
    return '非法请求';
});

//不需要验证的路由
Route::group(function () {
    Route::post('oauth_login', 'oauth/oauth_login'); //授权登录
    Route::post('get_session_key', 'oauth/get_session_key'); //session_key
    Route::get("get_token", "app\api\controller\User@get_token")->name("user.get_token");// tokken
    Route::any("h5oauth", "app\api\controller\WechatOauth@index")->name("wechatoauth.index");// 原生h5授权
    Route::any("thirdh5oauth", "app\api\controller\ThreeOauth@index")->name("thirdoauth.index");// 第三方h5授权
    Route::post("get_share_jssddk", "app\api\controller\WechatOauth@share")->name("wechatoauth.share");// 原生获取分享jssdk
    Route::post('pcoauth', 'PcOauth/oauth_login'); //PC端微信扫码登录
    Route::any('push', 'Push/index'); //小程序异步消息推送

    Route::get("get_banner", "app\api\controller\Banner@get_banner")->name("banner.get_banner");// 轮播列表
    Route::get("get_new_goods", "app\api\controller\Home@get_new_goods")->name("home.get_new_goods");// 轮播列表
    Route::get("get_hot_goods", "app\api\controller\Home@get_hot_goods")->name("home.get_hot_goods");// 热门商品
    Route::get('goods_list', 'goods/goods_list'); //定制实物列表
    Route::get('goods_list_digital', 'goods/goods_list_digital'); //数字珍品列表
    Route::get('search_goods_list', 'goods/search_goods_list'); //数字搜索
    
})
->allowCrossDomain();// 跨域


//用户
Route::group(function () {
    Route::get("user_detail", "app\api\controller\User@user_detail")->name("question.user_detail");// 用户详情
    Route::post('perfect_info', 'oauth/perfect_info'); //更新头像昵称
    Route::post('de_unionid', 'oauth/de_unionid'); //解密unionid
    Route::post('de_mobile', 'oauth/de_mobile'); //解密手机号
})
->allowCrossDomain()
->middleware(\app\api\middleware\TokenMiddleware::class,true);// jwt认证



Route::group(function(){
    Route::get('goods_category', 'goods/category'); //商品分类

    Route::any('notify', 'order/notify'); //支付回调
    Route::get('goods_comments', 'goods/goods_comments'); //商品评价
    Route::get('check_order_expire', 'task/check_order_expire'); //定时任务 订单自动过期
    Route::get('auto_take', 'task/auto_take'); //定时任务 订单自动收货

    Route::get('certificate_detail', 'order/certificate_detail'); //证书详情
});

Route::group(function(){
    Route::get('goods_detail', 'goods/detail'); //商品详情
    Route::get('recommend_goods', 'goods/recommend_goods'); //推荐商品
    Route::get('view_goods', 'goods/view_goods'); //最近浏览
    Route::post('goods_collection', 'goods/goods_collection'); //商品收藏/取消收藏
    Route::get('my_collection', 'goods/my_collection'); //我的收藏
    Route::post('add_cart', 'goods_cart/add'); //添加购物车
    Route::post('confirm_order', 'order/confirm'); //确认订单
    Route::post('confirm_orders', 'order/confirms'); //购物车确认订单
    Route::post('create_order', 'order/create'); //提交订单
    Route::get('order_list', 'order/order_list'); //订单列表
    Route::post('cancer_order', 'order/cancel'); //订单取消
    Route::post('delete_order', 'order/del'); //订单删除
    Route::post('order_comment', 'order/comment'); //订单评价
    Route::post('order_pay', 'order/pay'); //已存在订单支付
    Route::post('order_sure', 'order/take'); //订单收货
    Route::post('order_refund', 'order/refund'); //申请退款
    Route::get('order_detail', 'order/detail'); //订单详情
    Route::post('order_create_certificate', 'order/certificate_create'); //生成证书
    Route::get('user_coupon', 'coupon/user_coupon'); //我的优惠券
    Route::get('coupon_list', 'coupon/list'); //我的优惠券
    Route::post('receive_coupon', 'coupon/receive'); //领取优惠券
    Route::get('user_cart', 'goods_cart/list'); //我的购物车
    Route::post('cart_num', 'goods_cart/num'); //更改购物车数量
    Route::post('del_cart', 'goods_cart/del'); //删除购物车
    Route::post('order_computed', 'order/computedOrder'); //计算订单金额
    Route::post('addressComputedOrder', 'order/addressComputedOrder'); //地址重新计算价格
    Route::get('address_list', 'user_address/address_list'); //收货地址列表
    Route::post('add_address', 'user_address/add'); //添加收货地址
    Route::post('edit_address', 'user_address/add'); //编辑收货地址
    Route::post('del_address', 'user_address/address_del'); //删除收货地址
    Route::post('set_address_default', 'user_address/set_address_default'); //设置默认收货地址
    Route::get('get_address_default', 'user_address/get_address_default');

    Route::get('get_city_data', 'user_address/get_region'); //省市区

    Route::post('artist_follow', 'artist_follow/follow'); //艺术家关注/取消
    Route::get('my_artist_follow', 'artist_follow/myFollow'); //我的艺术家关注列表
    Route::get('artist_detail', 'artist_follow/artist_detail'); //艺术家详情
    Route::get('artist_works', 'artist_follow/artist_works'); //艺术家作品

    Route::post('user_auth/personal', 'user_auth_controller/personal'); //个人认证提交
    Route::post('user_auth/company', 'user_auth_controller/company'); //企业认证提交

    Route::get('user_distributor_detail', 'distributor/user_distributor_detail'); //分销商详情
    Route::post('commission_apply', 'distributor/commission_apply'); //申请分销
    Route::get('user_commission', 'distributor/user_commission'); //我的佣金
    Route::post('withdrawal', 'distributor/withdrawal'); //我的佣金提现

    Route::get('my_digital_order', 'order/my_digital_order'); //我的数字珍品
    Route::get('my_digital_detail/:id', 'order/my_digital_detail'); //我的数字珍品详情

    Route::post('upload_img', 'user/upload_img'); //上传

    Route::get('goods_comments_detail', 'order/goods_comments_detail'); //商品评价详情
    Route::post('goods_comments_delete', 'order/goods_comments_delete'); //商品评价删除

})->allowCrossDomain()
->middleware(\app\api\middleware\TokenMiddleware::class,true);// jwt认证

